package com.windupurnomo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.windupurnomo.entity.Player;
import com.windupurnomo.entity.ShareInfo;

public class SelectedPlayer extends Activity{
	private TextView name, score;
	private TextView txtWaterPoint,txtFoodPoint, txtPaperPoint;
	private TextView txtPowerPoint, txtSocialFoint, txtFinancePoint, txtEiqPoint;
	private ImageView image;
	private Button btnNext;
	private ShareInfo shareInfo;
	
	public void onCreate(Bundle icicle){
		super.onCreate(icicle);
		setContentView(R.layout.selected_player);
		name = (TextView) findViewById(R.id.txtName);
		score = (TextView) findViewById(R.id.txtScore);
		image = (ImageView) findViewById(R.id.imageAvatar);
		btnNext = (Button) findViewById(R.id.btn_Next);
		txtWaterPoint = (TextView) findViewById(R.id.txtWaterPoint);
		txtFoodPoint = (TextView) findViewById(R.id.txtFoodPoint);
		txtPaperPoint =  (TextView) findViewById(R.id.txtPaperPoint);
		txtPowerPoint =  (TextView) findViewById(R.id.txtPowerPoint);
		txtSocialFoint =  (TextView) findViewById(R.id.txtSocialPoint);
		txtFinancePoint =  (TextView) findViewById(R.id.txtFinancePoint);
		txtEiqPoint = (TextView) findViewById(R.id.txtEIQPoint);
		
		shareInfo = (ShareInfo) getIntent().getSerializableExtra("shareInfo");
		Player player = shareInfo.getPlayer();
		name.setText(player.getName());
		score.setText(String.valueOf(player.getScore()));
		txtWaterPoint.setText(String.valueOf(player.getResource().getWater()));
		txtFoodPoint.setText(String.valueOf(player.getResource().getFood()));
		txtPaperPoint.setText(String.valueOf(player.getResource().getPaper()));
		txtPowerPoint.setText(String.valueOf(player.getCondition().getPower()));
		txtSocialFoint.setText(String.valueOf(player.getCondition().getSocial()));
		txtFinancePoint.setText(String.valueOf(player.getCondition().getFinance()));
		txtEiqPoint.setText(String.valueOf(player.getCondition().getEiq()));
		
		if(player.getSex().toLowerCase().equals("male")){
			image.setImageResource(R.drawable.male);
		}else{
			image.setImageResource(R.drawable.female);
		}
	}
}
